package com.longtengyuyun;

import java.util.concurrent.TimeUnit;

/**
 * @author ZhaoYunLong
 * @date 2022/3/25
 * @description
 */
public class TestFour {

    public static void main(String[] args) {
        TestFour testFour = new TestFour();
        new Thread(testFour::m1).start();
        new Thread(testFour::m2).start();
    }


    private synchronized void m1(){
        for (int i =0; i< 10; i++) {
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(i);
        }
    }


    private synchronized void m2(){
        System.out.println("m2");
    }




}
